/**
  ******************************************************************************
  * @file    bsp_spi.h
  * @author  Iron
  * @date    2018-08-29
  * @version v1.0
  * @brief   bsp_spi header file
  */

#ifndef __BSP_SPI_H
#define __BSP_SPI_H

#ifdef __cplusplus
extern "C" {
#endif

/* includes ------------------------------------------------------------------*/
#include <stdint.h>

/* exported types ------------------------------------------------------------*/
/* exported constants --------------------------------------------------------*/
/* exported macro ------------------------------------------------------------*/
#define BSP_SPI_FALSE   0
#define BSP_SPI_TRUE    1

#define BSP_SPI_NO_ERR  0
#define BSP_SPI_ERR     1
#define BSP_SPI_TIMEOUT 2

/* exported functions ------------------------------------------------------- */
int32_t bsp_spi_mutex_wait(uint32_t timeout);
int32_t bsp_spi_mutex_release(void);

int32_t bsp_spi_write(uint8_t *data, uint16_t len, uint32_t timeout);
int32_t bsp_spi_read(uint8_t *data, uint16_t len, uint32_t timeout);
int32_t bsp_spi_init(void);

/**
  * @}
  */

#ifdef __cplusplus
}
#endif

#endif /* __BSP_SPI_H */

/******************* (C)COPYRIGHT 2018 ***** END OF FILE *********************/
